package todolist.activities;

import java.util.Date;

import android.app.Application;
import android.content.Intent;
import android.os.Bundle;


public class TodoList extends Application {
	
	private int currentUserId;
	private int currentTaskId;
	private boolean newTask;
	private boolean showComplete;
	private String typesToShow;
	private boolean filterByDate;
	private String filterDate;
	
	public void initialize(){
		showComplete = false;
		typesToShow = "All";
	}
	
	public boolean checkDate(String date)
	{
		try
		{
			int token = date.indexOf("-");
			int month = Integer.parseInt(date.substring(0, token));
			String theRest = date.substring(token+2);
			
			token = theRest.indexOf("-");
			int day = Integer.parseInt(theRest.substring(0, token));
			int year = Integer.parseInt(theRest.substring(token+2));
			
			Date d = new Date(year, month, day);
			
			return true;
		}
		catch(Exception e)
		{
			return false;
		}
	}

	public int getCurrentUserId(){
		return currentUserId;
	}
	
	public void setCurrentUserId(int id){
		currentUserId=id;
	}

	/**
	 * @return the currentTask
	 */
	public int getCurrentTaskId() {
		return currentTaskId;
	}

	/**
	 * @param currentTask the currentTask to set
	 */
	public void setCurrentTaskId(int currentTaskId) {
		this.currentTaskId = currentTaskId;
	}

	/**
	 * @return the newTask
	 */
	public boolean isNewTask() {
		return newTask;
	}

	/**
	 * @param newTask the newTask to set
	 */
	public void setNewTask(boolean newTask) {
		this.newTask = newTask;
	}

	/**
	 * @return the showComplete
	 */
	public boolean isShowComplete() {
		return showComplete;
	}

	/**
	 * @param showComplete the showComplete to set
	 */
	public void setShowComplete(boolean showComplete) {
		this.showComplete = showComplete;
	}

	/**
	 * @return the typesToShow
	 */
	public String getTypesToShow() {
		if (typesToShow==null)
			typesToShow = "All";
		return typesToShow;
	}

	/**
	 * @param typesToShow the typesToShow to set
	 */
	public void setTypesToShow(String typesToShow) {
		this.typesToShow = typesToShow;
	}

	public String getFilterDate() {
		if (filterDate==null)
			return "";
		return filterDate;
	}

	public void setFilterDate(String filterDate) {
		this.filterDate = filterDate;
	}

	public boolean isFilterByDate() {
		return filterByDate;
	}

	public void setFilterByDate(boolean filterByDate) {
		this.filterByDate = filterByDate;
	}
	
}
